﻿namespace FunctionalProgramming.PatternMatching.TransformingRules
{
   /// <summary>
   /// Rule that transforms values.
   /// </summary>
   /// <typeparam name="TIn">The type of the input.</typeparam>
   /// <typeparam name="TOut">The type of the output.</typeparam>
   internal interface ITransformingRule<TIn, TOut>
   {
      /// <summary>
      /// Examines the provided input and determines whether it matches the rule or not.
      /// </summary>
      /// <param name="input">The input.</param>
      /// <returns><c>true</c> if the input matches the rule; otherwise, <c>false</c>.</returns>
      bool DoesInputMatch(TIn input);

      /// <summary>
      /// Transforms the provided input to output value.
      /// </summary>
      /// <param name="input">The input.</param>
      /// <returns>The output</returns>
      TOut TransformInput(TIn input);
   }
}